package com.kly.smartbi.model.enums;

import lombok.Getter;

/**
 * @author admin
 * @date 2025/3/30
 */
@Getter
public enum ChartTypeEnum {
    // 定义所有图表类型枚举常量
    LINE("line", "折线图"),
    BAR("bar", "柱状图"),
    PIE("pie", "饼图"),
    SCATTER("scatter", "散点图"),
    AREA("area", "面积图"),
    HISTOGRAM("histogram", "直方图"),
    RADAR("radar", "雷达图"),
    HEATMAP("heatmap", "热力图"),
    BOXPLOT("boxplot", "箱线图"),
    MAP("map", "地图"),
    TREEMAP("treemap", "树状图");

    // 私有字段
    private final String value;
    private final String label;

    ChartTypeEnum(String value, String label) {
        this.value = value;
        this.label = label;
    }


    /**
     * 根据 value 获取枚举
     * @param value
     * @return
     */
    public static ChartTypeEnum getEnumByValue(String value) {
        for (ChartTypeEnum anEnum : ChartTypeEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
